/*
 *  Point2f.cpp
 *  openFrameworks
 *
 *  Created by allesblinkt on 5/18/09.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *
 */

#include "Point2f.h"

namespace abliefern {
	
	Point2f::Point2f(float theX, float theY){
	
		x = theX;
		y = theY;
	
	
	}
	
	
	Point2f::Point2f(){
		
		x = 0;
		y = 0;
		
		
	}
	
	
	
	
	float Point2f::distanceSquared(Point2f* theOtherPoint){
		float theXDifference = x - theOtherPoint->x;
		float theYDifference = y - theOtherPoint->y;

		return (theXDifference * theXDifference + theYDifference * theYDifference);
		
	}
	
	
	float Point2f::distanceSquared(float theX, float theY){
		float theXDifference = x - theX;
		float theYDifference = y - theY;
		
		return (theXDifference * theXDifference + theYDifference * theYDifference);
		
	}
	
	
	void Point2f::scale(float theScalar){
		x *= theScalar;
		y *= theScalar;
		
	}
	
	
	void Point2f::divide(float theDivisor){
		y /= theDivisor;
		x /= theDivisor;
	}
	
	
	void Point2f::add(float theX, float theY){
		x += theX;
		y += theY;
		
	}
	
	
	void Point2f::subtract(float theX, float theY){
		x -= theX;
		y -= theY;
		
	}

	
	bool Point2f::isOver(int theX, int theY, int theDiameter){

		if(distanceSquared(theX, theY) < theDiameter * theDiameter){
			return true;
		}

		
		return false;

	
	}
	
}
